<template>
<div>
<Home-Header :city="city"></Home-Header>
<Home-Swiper :list="list"></Home-Swiper>
<Home-Icons :iconList='iconList'></Home-Icons>
<home-recommoned></home-recommoned>
</div>
</template>

<script>
import HomeHeader from './components/header'
import HomeSwiper from './components/swiper'
import HomeIcons from './components/icons'
import HomeRecommoned from './components/recommoned'
import axios from 'axios'
export default {
  name: 'home',
  data () {
    return {
      city: '',
      list: [],
      iconList: []
    }
  },
  components: {
    HomeHeader,
    HomeSwiper,
    HomeIcons,
    HomeRecommoned
  },
  methods: {
    getHomeInfo () {
      axios.get('/api/index.json')
        .then(this.getHomeInfoSucc)
    },
    getHomeInfoSucc (res) {
      res = res.data
      if (res.ret && res) {
        const data = res.data
        this.city = data.city
        this.list = data.swiperList
        this.iconList = data.iconList
      }
    }
  },
  mounted () {
    this.getHomeInfo()
  }
}
</script>

<style>

</style>
